<template>
  <div class="box">
    <h2>Son1 子组件</h2>
    从Vuex中获取的count值为：<label>{{ $store.state.count }}</label>
    <br>
    <button @click="add">+ 1</button>
    <button @click="addCount(5)">+ 5</button>
    <button @click="addCountAsync(10)">1秒后 + 10</button>
    <p>{{ $store.getters.filterList }}</p>
    <p>{{ filterList }}</p>
  </div>
</template>
<script>

import { mapActions, mapGetters, mapMutations } from 'vuex'

export default {
  name: 'SonOne',
  data () {
    return {}
  },
  computed: {
    ...mapGetters(['filterList'])
  },
  methods: {
    add () {
      this.$store.commit('addCount', 1)
    },
    ...mapMutations(['addCount']),
    ...mapActions(['addCountAsync'])
  }
}
</script>
<style>
.box {
  border: 1px solid red;
  width: 400px;
  padding: 10px;
  margin: 10px;
}

h2 {
  margin-top: 10px;
}
</style>
